﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _1_4 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        Label[] lbCPMC = new Label[] { this.CPMC1, this.CPMC2, this.CPMC3, this.CPMC4, this.CPMC5 };
        Label[] lbDW = new Label[] { this.DW1, this.DW2, this.DW3, this.DW4, this.DW5 };
        Label[] lbWSL = new Label[] { this.WSL1, this.WSL2, this.WSL3, this.WSL4, this.WSL5 };
        Label[] lbFQL = new Label[] { this.FQL1, this.FQL2, this.FQL3, this.FQL4, this.FQL5 };
        Label[] lbSWRW = new Label[] { this.SWRW1, this.SWRW2, this.SWRW3, this.SWRW4, this.SWRW5, this.SWRW6, this.SWRW7, this.SWRW8, this.SWRW9, this.SWRW10, this.SWRW11, this.SWRW12, this.SWRW13, this.SWRW14, this.SWRW15 };
        Label[] lbSWRWL = new Label[] { this.SWRWL1, this.SWRWL2, this.SWRWL3, this.SWRWL4, this.SWRWL5, this.SWRWL6, this.SWRWL7, this.SWRWL8, this.SWRWL9, this.SWRWL10, this.SWRWL11, this.SWRWL12, this.SWRWL13, this.SWRWL14, this.SWRWL15 };
        Label[] lbQWRW = new Label[] { this.QWRW1, this.QWRW2, this.QWRW3, this.QWRW4, this.QWRW5, this.QWRW6, this.QWRW7, this.QWRW8, this.QWRW9, this.QWRW10, this.QWRW11, this.QWRW12, this.QWRW13, this.QWRW14, this.QWRW15 };
        Label[] lbQWRWL = new Label[] { this.QWRWL1, this.QWRWL2, this.QWRWL3, this.QWRWL4, this.QWRWL5, this.QWRWL6, this.QWRWL7, this.QWRWL8, this.QWRWL9, this.QWRWL10, this.QWRWL11, this.QWRWL12, this.QWRWL13, this.QWRWL14, this.QWRWL15 };

        using (DataClassesDataContext mydata = new DataClassesDataContext())
        {
            var rd1 = from a in mydata.a01104_1
                      where a.qiyeid == Convert.ToInt32(Session["qiyeid"])
                      where a.DATA_MONTH == Convert.ToString(Session["ShenBaoNianDu"])
                      select a;
            int i = 0;
            int j = 0;
            foreach (var r1 in rd1)
            {
                lbCPMC[i].Text = r1.PRODUCT_NAME;
                lbDW[i].Text = r1.PRODUCT_UNIT;
                lbWSL[i].Text = r1.WATER_OUTVALUE==null?"":Convert.ToString(r1.WATER_OUTVALUE);
                lbFQL[i].Text = r1.GAS_OUTVALUE==null?"":Convert.ToString(r1.GAS_OUTVALUE);
                j = i * 3 + 1;
                var rd2 = from a in mydata.a01104_2
                          join c in mydata.CODE_POLLUTION_TABLE on a.CODE equals c.CODE
                          where a.qiyeid == Convert.ToInt32(Session["qiyeid"])
                          where a.DATA_MONTH == Convert.ToString(Session["ShenBaoNianDu"])
                          where a.PRODUCT_ID == r1.PRODUCT_ID
                          where c.P_TYPE==Convert.ToChar("1") //废水
                          select new {c.NAME,a.OUT_VALUE};
                foreach (var r2 in rd2)
                {
                    lbSWRW[j].Text = r2.NAME;
                    lbSWRWL[j].Text = r2.OUT_VALUE == null ? "" : Convert.ToString(r2.OUT_VALUE);
                }
                var rd3 = from a in mydata.a01104_2
                          join c in mydata.CODE_POLLUTION_TABLE on a.CODE equals c.CODE
                          where a.qiyeid == Convert.ToInt32(Session["qiyeid"])
                          where a.DATA_MONTH == Convert.ToString(Session["ShenBaoNianDu"])
                          where a.PRODUCT_ID == r1.PRODUCT_ID
                          where c.P_TYPE == Convert.ToChar("2") //废水
                          select new { c.NAME, a.OUT_VALUE };
                foreach (var r3 in rd3)
                {
                    lbQWRW[j].Text = r3.NAME;
                    lbQWRWL[j].Text = r3.OUT_VALUE == null ? "" : Convert.ToString(r3.OUT_VALUE);
                }
            }
        
        }


    }
    
}